<?php


namespace app\admin\model\view;

use app\logic\model\view\UserWithdrawUserView as UserWithdrawUser;

class UserWithdrawUserView extends UserWithdrawUser
{
    function getList($request,$limit){
        $list=$this->where(function($q) use ($request){
            if(check_request($request,"keywords")){
                $q->whereLike("user_nickname|user_true_name|user_mobile","%{$request['keywords']}%");
            }
            if(check_request($request,"status")){
                $q->where("status",$request['status']);
            }
            if(check_request($request,'start_time')&&check_request($request,'end_time')){
                $q->whereBetween("create_time",[strtotime($request['start_time']),strtotime($request['end_time']." 23:59:59")]);
            }elseif (check_request($request,'start_time')){
                $q->where("create_time",">=",strtotime($request['start_time']));
            }elseif (check_request($request,'end_time')){
                $q->where("create_time","<=",strtotime($request['end_time']." 23:59:59"));
            }
        })->order('id desc')->paginate($limit);
        if(!$list->isEmpty()){
            return $list->toArray();
        }
        return $list;
    }

}